const vIf = (id) => {
    //不在course/admin/public/index.html里面引入这个js文件，this无法识别
    // let _this = this;
    // let resources = _this.getLoginUser().resources;
    let resources = Tool.getLoginUser().resources;
    if (Tool.isEmpty(resources)) {
        return false;
    }
    for (let i = 0; i < resources.length; i++) {
        if (id === resources[i].id) {
            return true;
        }
    }
    return false;
};

const vShow = (id) => {
    return vIf(id);
};

const routerAuth = (router) => {
    let resources = Tool.getLoginUser().resources;
    if (Tool.isEmpty(resources)) {
        return false;
    }
    for (let i = 0; i < resources.length; i++) {
        if (router === resources[i].page) {
            return true;
        }
    }
    return false;
};


export default{
    vIf,
    vShow,
    routerAuth,
}